home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1999 March / EnigmA AMIGA RUN 35 (1999)(G.R. Edizioni)(IT)[!][issue 1999-03].iso / earcd / devel / vbcc-68k-src / machines / amiga68k / include / string.h < prev    next >
C/C++ Source or Header  |  1999-01-01  |  5KB  |  215 lines

  1. #ifndef __STRING_H
  2. #define __STRING_H 1
  3.  
  4. #ifndef __SIZE_T
  5. #define __SIZE_T 1
  6. typedef unsigned long size_t;
  7. #endif
  8.  
  9. #undef NULL
  10. #define NULL ((void *)0)
  11.  
  12. void *memcpy(void *,const void *,size_t);
  13. void *memmove(void *,const void *,size_t);
  14. char *strcpy(char *,const char *);
  15. char *strncpy(char *,const char *,size_t);
  16. char *strcat(char *,const char *);
  17. char *strncat(char *,const char *,size_t);
  18. int memcmp(const void *,const void *,size_t);
  19. int strcmp(const char *,const char *);
  20. int strncmp(const char *,const char *,size_t);
  21. void *memchr(const void *,int,size_t);
  22. char *strchr(const char *,int);
  23. size_t strcspn(const char *,const char *);
  24. char *strpbrk(const char *,const char *);
  25. char *strrchr(const char *,int);
  26. size_t strspn(const char *,const char *);
  27. char *strstr(const char *,const char *);
  28. void *memset(void *,int,size_t);
  29. size_t strlen(const char *);
  30. char *strtok(char *,const char *);
  31. char *strerror(int);
  32.  
  33. #ifdef __INLINE_ALL
  34. #define __INLINE_MEMCHR
  35. #define __INLINE_MEMCMP
  36. #define __INLINE_MEMCPY
  37. #define __INLINE_MEMMOVE
  38. #define __INLINE_MEMSET
  39. #define __INLINE_STRCAT
  40. #define __INLINE_STRCHR
  41. /*#define __INLINE_STRCMP*/
  42. /*#define __INLINE_STRCPY*/
  43. #define __INLINE_STRCSPN
  44. #define __INLINE_STRERROR
  45. /*#define __INLINE_STRLEN*/
  46. #define __INLINE_STRNCAT
  47. /*#define __INLINE_STRNCMP*/
  48. /*#define __INLINE_STRNCPY*/
  49. #define __INLINE_STRPBRK
  50. #define __INLINE_STRRCHR
  51. #define __INLINE_STRSPN
  52. #define __INLINE_STRSTR
  53. #define __INLINE_STRTOL
  54. #endif
  55.  
  56. #ifdef __INLINE_MEMCHR
  57. #pragma only-inline on
  58. #include "vbcc:libsrc/string/memchr.c"
  59. #pragma only-inline off
  60. #endif
  61. #ifdef __INLINE_MEMCMP
  62. #pragma only-inline on
  63. #include "vbcc:libsrc/string/memcmp.c"
  64. #pragma only-inline off
  65. #endif
  66. #ifdef __INLINE_MEMCPY
  67. #pragma only-inline on
  68. #include "vbcc:libsrc/string/memcpy.c"
  69. #pragma only-inline off
  70. #endif
  71. #ifdef __INLINE_MEMMOVE
  72. #pragma only-inline on
  73. #include "vbcc:libsrc/string/memmove.c"
  74. #pragma only-inline off
  75. #endif
  76. #ifdef __INLINE_MEMSET
  77. #pragma only-inline on
  78. #include "vbcc:libsrc/string/memset.c"
  79. #pragma only-inline off
  80. #endif
  81. #ifdef __INLINE_STRCAT
  82. #pragma only-inline on
  83. #include "vbcc:libsrc/string/strcat.c"
  84. #pragma only-inline off
  85. #endif
  86. #ifdef __INLINE_STRCHR
  87. #pragma only-inline on
  88. #include "vbcc:libsrc/string/strchr.c"
  89. #pragma only-inline off
  90. #endif
  91. #ifdef __INLINE_STRCMP
  92. #pragma only-inline on
  93. #include "vbcc:libsrc/string/strcmp.c"
  94. #pragma only-inline off
  95. #endif
  96. #ifdef __INLINE_STRCPY
  97. #pragma only-inline on
  98. #include "vbcc:libsrc/string/strcpy.c"
  99. #pragma only-inline off
  100. #endif
  101. #ifdef __INLINE_STRCSPN
  102. #pragma only-inline on
  103. #include "vbcc:libsrc/string/strcspn.c"
  104. #pragma only-inline off
  105. #endif
  106. #ifdef __INLINE_STRERROR
  107. #pragma only-inline on
  108. #include "vbcc:libsrc/string/strerror.c"
  109. #pragma only-inline off
  110. #endif
  111. #ifdef __INLINE_STRLEN
  112. #pragma only-inline on
  113. #include "vbcc:libsrc/string/strlen.c"
  114. #pragma only-inline off
  115. #endif
  116. #ifdef __INLINE_STRNCAT
  117. #pragma only-inline on
  118. #include "vbcc:libsrc/string/strncat.c"
  119. #pragma only-inline off
  120. #endif
  121. #ifdef __INLINE_STRNCMP
  122. #pragma only-inline on
  123. #include "vbcc:libsrc/string/strncmp.c"
  124. #pragma only-inline off
  125. #endif
  126. #ifdef __INLINE_STRNCPY
  127. #pragma only-inline on
  128. #include "vbcc:libsrc/string/strncpy.c"
  129. #pragma only-inline off
  130. #endif
  131. #ifdef __INLINE_STRPBRK
  132. #pragma only-inline on
  133. #include "vbcc:libsrc/string/strpbrk.c"
  134. #pragma only-inline off
  135. #endif
  136. #ifdef __INLINE_STRRCHR
  137. #pragma only-inline on
  138. #include "vbcc:libsrc/string/strrchr.c"
  139. #pragma only-inline off
  140. #endif
  141. #ifdef __INLINE_STRSPN
  142. #pragma only-inline on
  143. #include "vbcc:libsrc/string/strspn.c"
  144. #pragma only-inline off
  145. #endif
  146. #ifdef __INLINE_STRSTR
  147. #pragma only-inline on
  148. #include "vbcc:libsrc/string/strstr.c"
  149. #pragma only-inline off
  150. #endif
  151. #ifdef __INLINE_STRTOK
  152. #pragma only-inline on
  153. #include "vbcc:libsrc/string/strtok.c"
  154. #pragma only-inline off
  155. #endif
  156.  
  157. size_t strlen(__reg("a0") const char *) =
  158.         "\tmove.l\ta0,d0\n"
  159.         ";=barrier\n"
  160.         "\ttst.b\t(a0)+\n"
  161.         "\tbne.b\t*-4\n"
  162.         "\tsub.l\ta0,d0\n"
  163.         "\tnot.l\td0";
  164.  
  165. char *strcpy(__reg("a0") char *, __reg("a1") const char *) =
  166.         "\tmove.l\ta0,d0\n"
  167.         ";=barrier\n"
  168.         "\tmove.b\t(a1)+,(a0)+\n"
  169.         "\tbne.b\t*-4";
  170.  
  171. char *strncpy(__reg("a0") char *, __reg("a1") const char *,
  172.               __reg("d1") size_t) =
  173.         "\tmove.l\ta0,d0\n"
  174.         "\tbra.b\t*+6\n"
  175.         ";=barrier\n"
  176.         "\tmove.b\t(a1),(a0)+\n"
  177.         "\tbeq.b\t*+2\n"
  178.         "\taddq.l\t#1,a1\n"
  179.         ";=barrier\n"
  180.         "\tsubq.l\t#1,d1\n"
  181.         "\tbpl.b\t*-10";
  182.  
  183. int strcmp(__reg("a0") const char *, __reg("a1") const char *) =
  184.         "\tmoveq\t#0,d0\n"
  185.         "\tmoveq\t#0,d1\n"
  186.         ";=barrier\n"
  187.         "\tmove.b\t(a0)+,d0\n"
  188.         "\tmove.b\t(a1)+,d1\n"
  189.         "\tbeq.b\t*+6\n"
  190.         "\tsub.l\td1,d0\n"
  191.         "\tbeq.b\t*-10\n"
  192.         "\tmoveq\t#0,d1\n"
  193.         ";=barrier\n"
  194.         "\tsub.l\td1,d0";
  195.  
  196. int strncmp(__reg("a0") const char *, __reg("a1") const char *,
  197.             __reg("d2") size_t) =
  198.         "\tmoveq\t#0,d0\n"
  199.         "\tmoveq\t#0,d1\n"
  200.         ";=barrier\n"
  201.         "\tsubq.l\t#1,d2\n"
  202.         "\tbmi.b\t*+14\n"
  203.         "\tmove.b\t(a0)+,d0\n"
  204.         "\tmove.b\t(a1)+,d1\n"
  205.         "\tbeq.b\t*+6\n"
  206.         "\tsub.l\td1,d0\n"
  207.         "\tbeq.b\t*-14\n"
  208.         "\tmoveq\t#0,d1\n"
  209.         ";=barrier\n"
  210.         "\tsub.l\td1,d0";
  211.  
  212.  
  213. #endif
  214.  
  215.